from typing import Dict, Any
from fastapi import HTTPException, status


def create_auth_error(error_type: str, message: str) -> Dict[str, Any]:
    """Create standardized authentication error response"""
    return {
        "error": error_type,
        "message": message
    }


def raise_auth_error(error_type: str, message: str, status_code: int = status.HTTP_401_UNAUTHORIZED):
    """Raise standardized authentication error"""
    raise HTTPException(
        status_code=status_code,
        detail=create_auth_error(error_type, message)
    )


def create_validation_error(message: str, details: list = None) -> Dict[str, Any]:
    """Create standardized validation error response"""
    error = {
        "error": "validation_error",
        "message": message
    }
    if details:
        error["details"] = details
    return error 